package com.dataart.productshop.dao.impl;

import com.dataart.productshop.dao.BaseDao;
import com.dataart.productshop.dao.StudentDao;
import com.dataart.productshop.model.boiko.informationsystem.Lecturer;
import com.dataart.productshop.model.boiko.informationsystem.Student;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class StudentDaoImpl extends BaseDaoImpl<Student> implements StudentDao{
    public StudentDaoImpl() {
        super(Student.class);
    }
    @Override
    public List<Student> getByName(String name){
        return createCriteria(Student.class)
                .add(Restrictions.eq("name", name))
                .list();
    }

    @Override
    public List<Student> getStudentByNameQuery(String query){
        return createCriteria(Student.class)
                .add(Restrictions.like("name", "%"+query+"%"))
                .list();
    }
}
